-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add x86_64-apple-darwin target #480
Conversation
0d7e2da
to
c8c6193
Compare
This adds support for the x86_64-apple-darwin target using [osxcross](https://github.com/tpoechtrager/osxcross).
c8c6193
to
4ef21bc
Compare
Any updates on this? @Dylan-DPC Would love to have the apple-darwin target included with cross! |
@brooksmtownsend sorry have been busy so didn't get a chance to look at this. Will have a look when I have time. I'm assuming we will need to add a CI target as well? |
Would |
Yeah, I think it would need a CI target but I wasn't quite sure how to add one that would test compiling x86_64-apple-darwin on linux. Does someone have an idea on what would need to be changed? I presume it is adding something to this file: https://github.com/rust-embedded/cross/blob/master/azure-pipelines.yml |
Hey, just pinging this issue, it'd be great to have the docker files in even if building them requires users provide their own SDK bundles per the README. It would also be wonderful if there were one added for aarch64 🙏. I don't think it'd be too much more work but can also see that as a separate PR |
Hello I am fairly new to rust but I run into an issue when cross-compiling a cli-tool which makes use of
Not sure if I understood everything correctly, but it seems like
Not sure though if this acceptable in all circumstances. Credits: https://wapl.es/rust/2019/02/17/rust-cross-compile-linux-to-macos.html |
@ChrisRx, could you rebase this and try adding a target? |
I don't think we can legally provide this as a pre-built image, and the an example of a major project that used this (and then removed it likely for legal reasons) is moby (Docker) itself, which did in early 2017 (see b96093f/Dockerfile where it's gone and f8dacaf/Dockerfile where it exists). However, we can provide a Dockerfile and tell users how to build it, as long as we don't integrate it in CI. |
Superseded in favor of #841. This provides a Dockerfile that we can ship legally, where we do not provide the SDK, so we do not run into legal issues distributing the macOS SDK in pre-built images. This Dockerfiles are live on cross-rs/cross-toolchains, and you can follow the instructions on the README to build the images. For example, for the full workflow for building an x86_64 target is as follows: $ git clone https://github.com/cross-rs/cross
$ cd cross
$ git submodule update --init --remote
# now, you can provide either `MACOS_SDK_URL` or `MACOS_SDK_FILE`
# `MACOS_SDK_DIR` is optional if `MACOS_SDK_FILE` is provided.
$ MACOS_SDK_URL=...
$ MACOS_SDK_FILE=...
$ cargo build-docker-image x86_64-apple-darwin-cross \
--build-arg 'MACOS_SDK_URL=$URL'
$ cargo build-docker-image x86_64-apple-darwin-cross \
--build-arg 'MACOS_SDK_DIR=$DIR' \
--build-arg 'MACOS_SDK_FILE=$FILE' Your [target.x86_64-apple-darwin]
image = "ghcr.io/cross-rs/x86_64-apple-darwin-cross:local"
[target.i686-apple-darwin]
image = "ghcr.io/cross-rs/i686-apple-darwin-cross:local" And now you can build as normal. This only needs Docker or Podman installed, so it won't require an additional dependency. $ cross build --target x86_64-apple-darwin I hope this is satisfactory for all involved? |
This adds support for the x86_64-apple-darwin target using osxcross. This would fix #223 (at least partially depending upon desire for other darwin targets like i386) and maybe addresses #436 because of the changes made to
needs_docker()
insrc/main.rs
.I tried to reuse/imitate as many things as I could from the other targets to try and make the first pass at this consistent with them, but let me know if something is missing or needs to be improved.